package org.xq.mq.config;

import lombok.extern.slf4j.Slf4j;
import org.xq.mq.component.OrderConsumer;
import org.xq.mq.container.RedisQueueConsumerContainer;

@Slf4j
//@Configuration
public class RedisQueueConfig {

    // 初始化完毕后调取 init
    //@Bean(initMethod = "init", destroyMethod = "destroy")
    public RedisQueueConsumerContainer redisQueueConsumerContainer() {
        log.info("redis队列开始加载");
        RedisQueueConsumerContainer redisQueueConsumerContainer = new RedisQueueConsumerContainer();

        // 添加消费者 OrderConsumer 到消费者容器
//        redisQueueConsumerContainer.addConsumer(new GoodsConsumer());

        redisQueueConsumerContainer.addConsumer(new OrderConsumer());
        redisQueueConsumerContainer.addConsumer(new OrderConsumer());
        redisQueueConsumerContainer.addConsumer(new OrderConsumer());
        log.info("redis队列开始加载成功");
        return redisQueueConsumerContainer;
    }
}
